﻿package mortal.game.view.copy.GroupTowerCopy.panel
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import com.gengine.resource.info.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import extend.language.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class GroupCopyRender2 extends GCellRenderer
    {
        private var _comBat:GTextFiled;
        private var _tcopy:TCopy;
        private var _mapIcon:GImageBitmap;
        private var _currnteCopyIcon:GBitmap;
        private var _title:GImageBitmap;
        private var _txt:GTextFiled;
        private var _selectBg:ScaleBitmap;

        public function GroupCopyRender2()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._mapIcon = UIFactory.gImageBitmap("", 3, 3, this);
            this._currnteCopyIcon = UIFactory.gBitmap("", 175, 10, this);
            var _loc_1:* = GlobalStyle.textFormatHuang.center();
            this._txt = UIFactory.gTextField("" + Language.getString(70916), 155, 51, 70, 20, null, GlobalStyle.textFormatHuang2.center());
            this._comBat = UIFactory.gTextField("", 155, 71, 70, 20, null, _loc_1);
            this._title = UIFactory.gImageBitmap("", 10, 20, this);
            this._selectBg = UIFactory.bg(0, 0, 237, this.height, this, ImagesConst.ForgingSelectBg);
            LoaderHelp.addResCallBack(ResFileConst.groupCopy, this.showSkin);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._comBat.dispose(param1);
            this._comBat = null;
            this._mapIcon.dispose(param1);
            this._mapIcon = null;
            this._title.dispose(param1);
            this._title = null;
            this._currnteCopyIcon.dispose(param1);
            this._currnteCopyIcon = null;
            this._txt.dispose(param1);
            this._txt = null;
            this._selectBg.dispose(param1);
            this._selectBg = null;
            this._tcopy = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function showSkin() : void
        {
            if (isDisposed)
            {
                return;
            }
            this._currnteCopyIcon.bitmapData = GlobalClass.getBitmapData(ImagesConst.GroupCopyFlag);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:* = Cache.instance.role.entityInfo.level;
            this._tcopy = param1.tCopy;
            this._currnteCopyIcon.visible = Cache.instance.group.isInCopyGroup && Cache.instance.group.sgroup.copyCode == this._tcopy.code;
            this._mapIcon.bitmapData = null;
            this._mapIcon.imgUrl = "groupTowerIcon_" + this._tcopy.icon + ".png";
            if (this._tcopy.enterMinLevel <= _loc_2 && _loc_2 <= this._tcopy.enterMaxLevel)
            {
                this.filters = [];
            }
            else
            {
                this.filters = [FilterConst.colorFilter2];
            }
            return;
        }// end function

        private function showMap(param1:SWFInfo) : void
        {
            if (isDisposed)
            {
                return;
            }
            this._mapIcon.bitmapData = param1.bitmapData;
            return;
        }// end function

        override public function set selected(param1:Boolean) : void
        {
            super.selected = param1;
            if (this._selectBg)
            {
                this._selectBg.visible = param1;
            }
            return;
        }// end function

    }
}
